using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace THSERP.Modules.Report
{
    public partial class RP019 : ReportForm
    {
        public RP019()
        {
            InitializeComponent();
        }

        private void fld_btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void RP019_Load(object sender, EventArgs e)
        {
            fld_dgcHRRP019Employees.Screen = this;
            fld_dgcHRRP019Employees.InitializeControl();

            InitializeDataSource();
        }

        public void InitializeDataSource()
        {
            THSList<HREmployeesInfo> lstEmployee = new THSList<HREmployeesInfo>();
            HREmployeesController objEmployeesController = new HREmployeesController();
            DataSet ds = objEmployeesController.GetAllObjects();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                HREmployeesInfo objEmployeesInfo = (HREmployeesInfo)objEmployeesController.GetObjectFromDataRow(row);
                objEmployeesInfo.HREmployeeTotalSale = objEmployeesController.GetTotalSale(objEmployeesInfo.HREmployeeID);
                objEmployeesInfo.HREmployeeTotalQty = objEmployeesController.GetTotalQty(objEmployeesInfo.HREmployeeID);
                lstEmployee.Add(objEmployeesInfo);
            }
            fld_dgcHRRP019Employees.DataSource = lstEmployee;
            fld_dgcHRRP019Employees.RefreshDataSource();
        }
    }
}